import React from 'react';
import { Navigate } from 'react-router-dom';

export default function AuthRouter(props) {
  const { children } = props;
  const token = localStorage.getItem('token');
  if (token) {
    return children;
  } else {
    <Navigate to='/login' />;
  }
}
